package com.sunkq.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        atomicInteger.set(10);
//        atomicInteger.getAndIncrement();
        atomicInteger.set(5);
        System.out.println(atomicInteger.compareAndSet(5, 2019)+"\t 当前值为："+atomicInteger.get());
    }
}
